<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 16-11-27
 * Time: 上午12:30
 */
namespace app\watershop\model;

use app\common\model\BaseMember;
use think\Db;
class ShopMember extends BaseMember{

    public function getMemberInfo($condition, $field='*' ){
        if(is_array($condition)){
            $condition['member_store']=session('shop');
        }else{
            $condition.=' AND `member_store`='.session('shop');
        }
        cache($this->cache_options);
        //条件和字段转换成字符串，md5加密
        $key = md5($condition).md5($field);
        $result = cache($key);
        if(!empty($result)){
            return json_decode($result,true);
        }else{
            $result = Db::name('shop_member')->field($field)->where($condition)->find();
            cache($key,json_encode($result),3600,'member');
            return $result;
        }
    }

    public function getMemberList($condition , $field , $order , $page ,$pagesize){}
}